/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package lcfgly.web;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 * XssFilter
 * XSS过滤
 * @author lcfgly
 * @Date 2015-1-29 9:07:46
 * @version 1.0
 */
public class XssFilter implements Filter{
    
    FilterConfig fc=null;

    @Override
    public void init(FilterConfig fc) throws ServletException {
        this.fc=fc;
    }

    @Override
    public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException {
        HttpServletRequest rq=(HttpServletRequest)sr;
        fc.doFilter(new XssHttpServletRequestWrapper(rq), sr1);
    }

    @Override
    public void destroy() {
        this.fc=null;
    }

}
